//--------------------------------------------------------------------------------------
// register the function
 var newRegistery1 = new Array("getMtMsHistory", "drawMtMsHistoryChart" );
 allJsonsRegistry = allJsonsRegistry.concat(newRegistery1);

//--------------------------------------------------------------------------------------
// implement the function.
// This draw the chart : for each date, we display the mtm of every player mtms
function drawMtMsHistoryChart(mtmHistoryData) 
{
	var mtmsdata = new google.visualization.DataTable();
	mtmsdata.addColumn('string', 'time');
	var nDates2 = mtmHistoryData.datesList.length
	var nPlayers = mtmHistoryData.datesList[0].playersList.length

    for( var player = 0; player < nPlayers; player++ )
    {
        mtmsdata.addColumn('number', mtmHistoryData.datesList[0].playersList[player].name);
    }

	mtmsdata.addRows(nDates2);
    for( var date = 0; date < nDates2; date++ )
    {
        mtmsdata.setValue(date, 0, mtmHistoryData.datesList[date].time);
        for( var player = 0; player < nPlayers; player++ )
        {
            mtmsdata.setValue(date, player+1, mtmHistoryData.datesList[date].playersList[player].mtm);
        }
    }

    var mtmschart = new google.visualization.LineChart(document.getElementById('mtmschart_div'));
	mtmschart.draw(mtmsdata, 
	    {
	        width: 600,
	        height: 300,
	        title: 'MtMs History',
	        lineWidth:1,
	        pointSize:1,
	        curveType:'function',
	        hAxis:{ textStyle:{color: 'black', fontName: 'arial', fontSize: 3, textPosition:'in'} },
	        vAxis:{ textStyle:{color: 'black', fontName: 'arial', fontSize: 3} }
	    });
};